package com.subaiqiao.yunshiyuan.entrance.ysy.mapper;

import com.subaiqiao.yunshiyuan.basis.mapper.BasisMapper;
import com.subaiqiao.yunshiyuan.entrance.ysy.pojo.UserInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 曹朝禹
 * @since 2022-05-13
 */
@Mapper
public interface UserInfoMapper extends BasisMapper<UserInfo> {

    @Select("SELECT COUNT(*) FROM user_info")
    Integer FindUserCount();

    @Select("SELECT COUNT(*) FROM user_info WHERE status=1")
    Integer FindUserDisabledCount();

    @Select("SELECT COUNT(*) FROM user_info WHERE TO_DAYS(NOW()) - TO_DAYS(create_datetime)=1")
    Integer FindUserYesterdayRegister();

    @Update("Update user_info set token=#{token} WHERE user_id=#{id}")
    void UpdateToken(@Param("token")String token,@Param("id")Integer Id);
}
